package mblog.core.pojos;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import org.springframework.util.StringUtils;

/**
 * 产品信息展示类，用于View层数据展示 Product信息从范客生活电商获取，范客资讯仅存储需要展示的Product信息：id，名称，价格，url；
 * 图片需从范客生活电商获取（改为本地存储路径？）
 * 
 * @author songdragon
 *
 */
public class Product implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7691801503239778769L;

	private long id;
	private String name;
	private BigDecimal price;
	private String url;
	private String defaultImageUrl;

	private int favorite;
	private int own;

	private int isFaxsun;
	private List<String> imageUrls = new ArrayList<String>();

	private Tag tag;

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public BigDecimal getPrice() {
		return price;
	}

	public void setPrice(BigDecimal price) {
		this.price = price;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public Tag getTag() {
		return tag;
	}

	public void setTag(Tag tag) {
		this.tag = tag;
	}

	public String getDefaultImageUrl() {
		return defaultImageUrl;
	}

	public void setDefaultImageUrl(String defaultImgUrl) {
		if (!StringUtils.isEmpty(defaultImgUrl)) {
			// FIXME: use static final String instead of "||"
			String[] imgUrls = defaultImgUrl.split("\\|\\|");
			this.defaultImageUrl = imgUrls[0];
			for (int i = 1; i < imgUrls.length; i++) {
				this.imageUrls.add(imgUrls[i]);
			}
		}
	}

	public int getFavorite() {
		return favorite;
	}

	public void setFavorite(int favoirte) {
		this.favorite = favoirte;
	}

	public int getOwn() {
		return own;
	}

	public void setOwn(int own) {
		this.own = own;
	}

	public int getIsFaxsun() {
		return isFaxsun;
	}

	public void setIsFaxsun(int isFaxsun) {
		this.isFaxsun = isFaxsun;
	}

	public List<String> getImageUrls() {
		return imageUrls;
	}

	public void setImageUrls(List<String> imageUrls) {
		this.imageUrls = imageUrls;
	}

}
